package com.panshi.qa.provider.modules.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panshi.qa.api.vo.ItemQueryVo;
import com.panshi.qa.provider.modules.domain.QaQuesitonRelevance;
import com.panshi.qa.provider.modules.domain.QaQuestionSystem;
import com.panshi.qa.provider.modules.mapper.QaQuestionSystemMapper;
import com.panshi.qa.provider.modules.service.QaQuestionSystemService;
import com.panshi.qa.provider.modules.service.ThTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class QaQuestionSystemServiceImpl extends ServiceImpl<QaQuestionSystemMapper, QaQuestionSystem> implements QaQuestionSystemService {
    @Autowired
    private ThTypeService thTypeService;

    //将查询问题列表统一返回给后台
    @Override
    public Map<String, Object> pageQuerySystem(ItemQueryVo itemQueryVo) {
        System.out.println("搜索对象              "+itemQueryVo.getSearchParams());
        //返回查询数据
        List<QaQuesitonRelevance> list = this.baseMapper.findQaQuestionSystemList(itemQueryVo);
        //返回查询数据的总记录数
        Integer total = this.baseMapper.findQaQuestionSystemListTotal(itemQueryVo);
        //返回对象
        Map<String,Object> map = new HashMap<>();
        map.put("code",0);
        map.put("msg","success");
        //记录数存储到返回对象
        map.put("count",total);
        //问答列表存储到返回对象
        map.put("data",list);
        System.out.println("--------------------");
        System.out.println(list);
        return map;
    }
}
